const mysql = require("mysql");

var con = mysql.createConnection({
    host: "192.168.182.144",
    port: 3306,
    user: "root",
    password: "ddd",
    database: "mydatabase",
});

var username = process.argv[2];
// 如果涉及到变量，要用？来代替
var selectSql = "select * from users where userName=?";
con.query(selectSql, [username], (err, result) => {
    if (err) {
        console.log(err);
    } else {
        // console.log(result);
        var userList = result;
        for (var i = 0; i < userList.length; i++) {
            console.log(userList[i]["age"]);
        }
    }
});
